package 五月打卡;

/*
 * @author  YxinMiracle
 * @date  2022-05-01 11:55
 * @Gitee: https://gitee.com/yxinmiracle
 */

public class 寻找旋转排序数组中的最小值 {

    public int findMin(int[] nums) {
        // 找出第一个比nums[-1]小的值的下标
        int left = 0;
        int right = nums.length;
        while (left < right){
            int min = (left + right) >> 1;
            if (nums[min] <= nums[nums.length-1]){
                right = min;
            }else {
                left ++;
            }
        }
        return right;
    }

    public static void main(String[] args) {

    }

}
